package com.eascs.workflow.auditorReplace.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eascs.app.dao.PageResult;
import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.workflow.auditorReplace.dao.IAuditorReplaceDao;
import com.eascs.workflow.auditorReplace.service.IAuditorReplaceService;
import com.eascs.workflow.auditorReplace.vo.AuditorReVo;
import com.eascs.workflow.common.vo.ModelResult;

@Service
public class AuditorReplaceServiceImpl implements IAuditorReplaceService {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	@Autowired
	IAuditorReplaceDao auditorReplaceDao;
	
	@Override
	public PageResult<Object[]> getauditorReVo(AuditorReVo vo) {
		return auditorReplaceDao.getAuditorListInProcess(vo);
	}

	@Override
	public ModelResult<Boolean> replaceAuditor(AuditorReVo vo) {
		ModelResult<Boolean> modelResult=new ModelResult<>();
		int updateAuditor = auditorReplaceDao.updateAuditor(vo);
		if (updateAuditor <= 0) {
			logger.info("auditorReplace.error.AuditorReplaceServiceImpl,exception:{}");
			throw new RuntimeException("流程审核人替换失败");
		}
		modelResult.withModel(true);
		return modelResult;
	}

	@Override
	public PageResult<Object[]> getReAuditor(AuditorReVo vo) {
		// TODO Auto-generated method stub
		return auditorReplaceDao.getReAuditor(vo);
	}

	@Override
	public List<Object[]> getLikeEmployeeList(AuditorReVo vo) {
		// TODO Auto-generated method stub
		return auditorReplaceDao.getLikeEmployeeList(vo);
	}
	
	
	
	
}
